/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lwjglbase;

import java.util.ArrayList;

public class EditGui extends Sprite{
    final static int ADD_MODE = 0;
    final static int DEL_MODE = 1;
    final static int MOD_MODE = 2;
    
    int mode = ADD_MODE;
    final String bgFName = LWJGLbase.SPRITES_PATH+"editGui.png";
    ArrayList<Button> buttons = new ArrayList<Button>();

    public EditGui() {
        depth = -.9f; //put it at the back
        initTex(bgFName);
        x = 0;
        y = 0;
        xsize = tex.getImageWidth();
        ysize = tex.getImageHeight();
        setupButtons();
    }
    public void handleClicks(float mx, float my) {
        for (Button button : buttons) {
            if(button.checkClicked(mx, my)) {
                String name = button.name;
                if("add".equals(name)) { //"add" first incase of null pointer
                    mode = ADD_MODE;
                } else if("delete".equals(name)) {
                    mode = DEL_MODE;
                } else if("modify".equals(name)) {
                    mode = MOD_MODE;
                }
            }
        }
    }

    @Override
    public void render() {
        super.render();
        for (Button button : buttons) {
            button.render();
        }
    }

    private void setupButtons() {
        buttons.add(new Button("addButton.png","add",40,80));
        buttons.add(new Button("delButton.png","delete",200,80));
        buttons.add(new Button("modButton.png","modify",40,160));
    }
}
